package yu.code.yurpc.registry;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

// 本地注册中心
public class LocalRegistry {
    private static final ConcurrentMap<String,Class<?>> REGISTRY = new ConcurrentHashMap<>();
    // 注册服务
    public static void register(String serviceName,Class<?> serviceClass)
    {
        REGISTRY.put(serviceName,serviceClass);
    }
    // 获取服务
    public static Class<?> get(String serviceName)
    {
        return REGISTRY.get(serviceName);
    }
    // 删除服务
    public static void remove(String serviceName)
    {
        REGISTRY.remove(serviceName);
    }
}
